package com.zhx.business.base;

import com.zhx.business.repository.ZhxRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;

import java.util.List;

@Slf4j
public class BaseServiceImpl<T> implements BaseService<T> {

    @Autowired
    private ZhxRepository<T> zhxRepository;

    public void setBaseDAO(ZhxRepository<T> zhxRepository) {
        this.zhxRepository = zhxRepository;
    }


    @Override
    public <S extends T> S saveAndFlush(S var1) {
        return zhxRepository.saveAndFlush(var1);
    }

    @Override
    public T getOne(String var1) {
        return zhxRepository.getOne(var1);
    }

    @Override
    public List findAll() {
        return zhxRepository.findAll();
    }

    @Override
    public List findAll(Sort var1) {
        return zhxRepository.findAll(var1);
    }

    @Override
    public List findAll(Iterable var1) {
        return zhxRepository.findAll(var1);
    }

    @Override
    public List save(Iterable var1) {
        return zhxRepository.save(var1);
    }

    @Override
    public void flush() {
        zhxRepository.flush();
    }

    @Override
    public void deleteInBatch(Iterable var1) {
        zhxRepository.deleteInBatch(var1);
    }

    @Override
    public void deleteAllInBatch() {
        zhxRepository.deleteAllInBatch();
    }

    @Override
    public List findAll(Example var1) {
        return zhxRepository.findAll(var1);
    }

    @Override
    public List findAll(Example var1, Sort var2) {
        return zhxRepository.findAll(var1, var2);
    }


    @Override
    public T findOne(Specification<T> var1) {
        return zhxRepository.findOne(var1);
    }

    @Override
    public List<T> findAll(Specification<T> var1) {
        return zhxRepository.findAll(var1);
    }

    @Override
    public Page<T> findAll(Specification<T> var1, Pageable var2) {
        return zhxRepository.findAll(var1,var2);
    }

    @Override
    public List<T> findAll(Specification<T> var1, Sort var2) {
        return zhxRepository.findAll(var1,var2);
    }

    @Override
    public long count(Specification<T> var1) {
        return zhxRepository.count(var1);
    }


    @Override
    public <S extends T> S save(S var1) {
        return zhxRepository.save(var1);
    }

    @Override
    public T findOne(String var1) {
        return zhxRepository.findOne(var1);
    }

    @Override
    public boolean exists(String var1) {
        return zhxRepository.exists(var1);
    }

    @Override
    public long count() {
        return zhxRepository.count();
    }

    @Override
    public void delete(String var1) {
        zhxRepository.delete(var1);
    }

    @Override
    public void delete(T var1) {
        zhxRepository.delete(var1);
    }

    @Override
    public void delete(Iterable<? extends T> var1) {
        zhxRepository.delete(var1);
    }

    @Override
    public void deleteAll() {
        zhxRepository.deleteAll();
    }
}